/**
 * 虚拟DOM工厂
 */
function sVdomFactory(){
    /**
     * 创建元素
     * @param {*} type 元素类型
     * @param {*} opt 可选项
     * @returns 
     */
    this.createElement = function(type, opt){
        opt = opt ? opt : {};

        var element = null;

        if(type == "sText"){
            element = new sText();
        }else if(type == "sParagraph"){
            element = new sParagraph();
        }else if(type == "sLayer"){
            element = new sLayer();
            element.children = [];
        }else if(type == "sImage"){
            element = new sImage();
        }else if(type == "sTable"){
            element = new sTable();
            element.style = {display: "block"};
        }else if(type == "sBreakline"){
            element = new sBreakline();
        }else if(type == "sCheckBox"){
            element = new sCheckBox(null, opt.id, opt.name, opt);
        }else if(type == "sRadio"){
            element = new sRadio(null, opt.id, opt.name, opt);
        }else if(type == "sInputBegin"){
            element = sInputBegin();
        }else if(type == "sInputEnd"){
            element = sInputEnd();
        }

        if(!element.style){
            element.style = {};
        }

        if(opt.style){
            element.style = {...element.style, ...opt.style};
        }

        return element;
    }
}